<template>
  <div class="resource">
    <el-card shadow="hover">
      <div>
        <i class="el-icon-search" />
        <span>筛选搜索</span>
        <el-button
          style="margin-left: 20px;"
          type="primary"
          size="small"
          icon="el-icon-search"
          @click="search"
        >
          搜索
        </el-button>
        <el-button icon="el-icon-refresh" size="small" @click="resetParams">
          重置
        </el-button>
      </div>
      <div style="margin-top: 15px">
        <el-form
          :inline="true"
          :model="params"
          size="small"
          label-width="140px"
        >
          <!-- <el-form-item label="证书订单编号：">
            <el-input
              v-model="params.ordersn"
              style="width: 200px"
              placeholder="输入订单编号"
              clearable
              @clear="search"
            />
          </el-form-item> -->
          <el-form-item label="证书名称:">
            <!-- <el-select
              v-model="params.certificateName"
              placeholder="请选择证书名称"
              @change="search"
              clearable
            >
              <el-option
                v-for="item in certOptions"
                :key="item.id"
                :label="item.name"
                :value="item.id"
              >
              </el-option>
            </el-select> -->
            <el-input
              v-model="params.certificateName"
              placeholder="输入证书名称"
              clearable
              @clear="search"
            />
          </el-form-item>
          <!-- <el-form-item label="下单人姓名：">
            <el-input
              v-model="params.realName"
              style="width: 200px"
              placeholder="输入下单人姓名"
              clearable
              @clear="search"
            />
          </el-form-item> -->
          <!-- <el-form-item label="客户电话：">
            <el-input
              v-model="params.phone"
              style="width: 200px"
              placeholder="输入客户电话"
              clearable
              @clear="search"
            />
          </el-form-item> -->
        </el-form>
      </div>
    </el-card>

    <div class="container">
      <div class="handle-box">
        <!-- <el-button
          size="small"
          type="primary"
          icon="el-icon-plus"
          @click="handleAdd"
          class="mr10"
          >新增</el-button
        > -->
       
      </div>

      <el-card shadow="hover">
        <span>待审核证书列表</span>
        <el-button
          type="warning"
          icon="el-icon-s-order"
          style="margin-left: 20px;"
          size="small"
          :disabled="multiple"
          @click="handleDelete"
          >批量审核</el-button
        >
        <el-button
          type="warning"
          icon="el-icon-s-order"
          style="margin-left: 20px;"
          size="small"
          :disabled="multiple"
          @click="handleTemplate"
          >批量生成模板</el-button
        >
         <el-button
          type="danger"
          icon="el-icon-delete"
          class="handle-del mr10"
          size="small"
          :disabled="multiple"
          @click="shanchu"
          >批量删除</el-button
        >
        <el-button
          type="info"
          icon="el-icon-upload2"
          class="handle-del mr10"
          size="small"
          @click="daoru"
          >导入模板</el-button
        >
        <!-- <a href="" style="width:97px;height:33px;backfround:yellow">
          下载模板
        </a> -->
         <el-button
          type="success"
          icon="el-icon-download"
          class="handle-del mr10"
          size="small"
          @click="xiazia"
          ><a :href='moban'>下载模板</a></el-button
        >
        <el-button
          type="primary"
          icon="el-icon-plus"
          style="margin-left: 20px;"
          size="small"
          @click="xinzeng"
          >新增</el-button
        >
        <el-table
          style="margin-top:20px"
          v-loading="loading"
          :data="tableData"
          border
          class="table"
          ref="multipleTable"
          header-cell-class-name="table-header"
          @selection-change="handleSelectionChange"
        >
          <el-table-column
            type="selection"
            width="50"
            align="center"
          ></el-table-column>
          <el-table-column type="index" label="编号" align="center" />
          <el-table-column
            prop="certificateName"
            label="考试科目"
            align="center"
            min-width="150"
            :show-overflow-tooltip="true"
          ></el-table-column>
          <el-table-column
            label="头像"
            min-width="150"
            align="center"
          >
            <template slot-scope="scope">
              <img :src="scope.row.headPortrait" alt="" width="80" height="80">
            </template>
          </el-table-column>
           <el-table-column
            prop="realName"
            label="姓名"
            align="center"
            min-width="150"
            :show-overflow-tooltip="true"
          ></el-table-column>
           <el-table-column
            prop="identityCard"
            label="身份证号"
            align="center"
            min-width="150"
            :show-overflow-tooltip="true"
          ></el-table-column>
           <el-table-column
            prop="address"
            label="地址"
            align="center"
            min-width="150"
            :show-overflow-tooltip="true"
          ></el-table-column>
           <el-table-column
            prop="certificationDate"
            label="发证日期"
            align="center"
            min-width="150"
            :show-overflow-tooltip="true"
          ></el-table-column>
          <el-table-column label="订单状态" align="center" min-width="150">
            <template slot-scope="scope">
              <span>{{ scope.row.state = 5?"待审核":'' }}</span>
            </template>
          </el-table-column>
          <el-table-column
            prop="payMoney"
            label="待支付金额/元"
            align="center"
            min-width="150"
          ></el-table-column>
          <el-table-column
            label="订单地址"
            min-width="150"
            align="center"
            :show-overflow-tooltip="true"
          >
            <template slot-scope="scope">
              <span>{{ scope.row.address }}</span>
            </template>
          </el-table-column>
          <el-table-column
            label="备注"
            min-width="100"
            align="center"
            :show-overflow-tooltip="true"
          >
            <template slot-scope="scope">
              <span>{{ scope.row.remarks }}</span>
            </template>
          </el-table-column>
          <el-table-column label="创建时间" align="center" min-width="170">
            <template slot-scope="scope">{{
              formatT(scope.row.createTime)
            }}</template>
          </el-table-column>
          <el-table-column
            label="操作"
            min-width="250"
            align="center"
            fixed="right"
          >
            <template slot-scope="scope">
              <el-button @click="addTemp(scope.row)" icon="el-icon-delete" type="text">
                审核
              </el-button>
              <!-- <el-button
                type="text"
                icon="el-icon-delete"
                @click="handleDelete(scope.row)"
                >审核</el-button
              > -->
              <el-button
                type="text"
                icon="el-icon-edit"
                @click="bianji(scope.row)"
                >编辑</el-button
              >
              <el-button
                type="text"
                icon="el-icon-delete"
                @click="shanchu(scope.row)"
                >删除</el-button>
            </template>
          </el-table-column>
        </el-table>
      </el-card>
      <div class="pagination">
        <pagination
          v-show="pageTotal > 0"
          :total="pageTotal"
          :page.sync="params.pageNum"
          :limit.sync="params.pageSize"
          @pagination="getData00"
        />
      </div>
    </div>
    <el-dialog title="新增" :visible.sync="open" width="40%">
      <el-form ref="form" :model="form" label-width="100px" :rules="rules">
        <el-form-item label="头像" prop="headPortrait">
          <el-upload
            :headers="headers"
            :action="`${baseUrl}/goods/goods/upload`"
            :show-file-list="false"
            :on-success="uploadPicUrl"
            class="avatar-uploader"
          >
            <img v-if="form.headPortrait" :src="form.headPortrait" class="avatar" />
            <i v-else class="el-icon-plus avatar-uploader-icon"></i>
          </el-upload>
        </el-form-item>
        <el-form-item label="二维码">
          <el-upload
            :headers="headers"
            :action="`${baseUrl}/goods/goods/upload`"
            :show-file-list="false"
            :on-success="uploadPicUrl1"
            class="avatar-uploader"
          >
            <img v-if="form.qrCode" :src=" form.qrCode" class="avatar" />
            <i v-else class="el-icon-plus avatar-uploader-icon"></i>
          </el-upload>
        </el-form-item>
        <el-form-item label="姓名" prop="realName">
          <el-input v-model="form.realName"></el-input>
        </el-form-item>
        <el-form-item label="身份证号" prop="identityCard">
          <el-input v-model="form.identityCard"></el-input>
        </el-form-item>
         <el-form-item label="发证日期" prop="certificationDate">
           <el-date-picker
            v-model="form.certificationDate"
            type="date"
             value-format="yyyy-MM-dd"
            placeholder="选择日期">
            </el-date-picker>
        </el-form-item>
        <el-form-item label="考试科目" prop="certificateName">
           <el-select v-model="form.certificateName" placeholder="请选择" style="width:100%" multiple>
                <el-option
                v-for="item in options"
                :key="item.dictValue"
                :label="item.dictLabel"
                :value="item.dictLabel">
                </el-option>
            </el-select>
        </el-form-item>
        <el-form-item label="地址" prop="address">
          <el-input v-model="form.address"></el-input>
        </el-form-item>
        <el-form-item label="来源">
          <el-input v-model="form.orderSource"></el-input>
        </el-form-item>
        <el-form-item label="订单状态">
          <el-input v-model="form.state"></el-input>
        </el-form-item>
        <el-form-item label="待支付金额" prop="payMoney">
          <el-input-number v-model="form.payMoney"></el-input-number>
        </el-form-item>
        <el-form-item label="备注">
          <el-input v-model="form.remarks"></el-input>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="openqx">取 消</el-button>
        <el-button type="primary" @click="okopen">确 定</el-button>
      </span>
    </el-dialog>
    <!-- 导入模板 -->
    <el-dialog
      title="导入模板"
      :visible.sync="godaoru"
      width="30%"
     >
      <el-form :model="forms">
        <el-form-item label="上传文件">
          <el-upload
            class="upload-demo"
            :action="baseUrl + '/mba/order/batchImport'"
            :headers="headers"
            :on-change="handleChange"
            :on-success="handleSuccessq"
            :file-list="fileList">
            <el-button size="small" type="primary">点击上传</el-button>
            <!-- <div slot="tip" class="el-upload__tip">只能上传jpg/png文件，且不超过500kb</div> -->
          </el-upload>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="godaoru = false">取 消</el-button>
        <el-button type="primary" @click="okdaoru = false">确 定</el-button>
      </span>
    </el-dialog>
    <el-dialog
        title="模板生成"
        :visible.sync="tempVis"
        width="80%">
        <div style="text-align:center"  class="preview" ref="previewImg">
          <img style="width:1000px;" src="@/assets/images/temol.jpg" alt=""  />
          <!-- orderSn -->
          <div class="watermarkc">
            <!-- <svg xmlns="http://www.w3.org/2000/svg" width="100%" height="50px"> -->
              <img style="width:121px;height:158px" :src="tempForm.headPortrait" alt="" srcset="">
            <!-- </svg> -->
          </div>
          <div class="watermarkb">
            <svg xmlns="http://www.w3.org/2000/svg" width="100%" height="50px">
              <text x="50%" y="50%"
                  alignment-baseline="middle"
                  text-anchor="middle"
                  font-weight="600"
                  font-color="#323232"
                  font-size="20"
                  font-family="microsoft yahe"
                  >
                  {{tempForm.orderSn}}
              </text>
            </svg>
          </div>
          <div class="watermark">
            <svg xmlns="http://www.w3.org/2000/svg" width="100%" height="50px">
              <text x="50%" y="50%"
                  alignment-baseline="middle"
                  text-anchor="middle"
                  font-weight="600"
                  font-color="#323232"
                  font-size="20"
                  font-family="microsoft yahe"
                  >
                  {{tempForm.realName}}
              </text>
            </svg>
          </div>
          <!-- id -->
          <div class="watermarka">
            <svg xmlns="http://www.w3.org/2000/svg" width="100%" height="50px">
              <text x="50%" y="50%"
                  alignment-baseline="middle"
                  text-anchor="middle"
                  font-weight="600"
                  font-color="#323232"
                  font-size="20"
                  font-family="microsoft yahe"
                  >
                  {{tempForm.identityCard}}
              </text>
            </svg>
          </div>
          <!-- 证书 -->
          <div class="watermarkd">
            <!-- <svg xmlns="http://www.w3.org/2000/svg" width="100%" height="50px"> -->
              <h3 x="50%" y="50%"
                  v-for="(item , index) in tempForm.certificate"
                  :key="index"
                  style="
                  font-weight:600;
                  font-size:20;
                  font-family:microsoft yahe;
                  color:#323232
                  "
                  >
                  {{item}}
              </h3>
            <!-- </svg> -->
          </div>
          <!-- 年月日 -->
          <div class="watermarke">
            <svg xmlns="http://www.w3.org/2000/svg" width="100%" height="50px">
              <text x="50%" y="50%"
                  style="display:block"
                  alignment-baseline="middle"
                  text-anchor="middle"
                  font-weight="600"
                  font-color="#323232"
                  font-size="20"
                  font-family="microsoft yahe"
                  >
                  {{tempForm.year}}年
              </text>
            </svg>
          </div>
          <!-- 年月日 -->
          <div class="watermarkf">
            <svg xmlns="http://www.w3.org/2000/svg" width="100%" height="50px">
              <text x="50%" y="50%"
                  style="display:block"
                  alignment-baseline="middle"
                  text-anchor="middle"
                  font-weight="600"
                  font-size="20"
                  font-color="#323232"
                  font-family="microsoft yahe"
                  >
                  {{tempForm.month}}月
              </text>
            </svg>
          </div>
          <!-- 年月日 -->
          <div class="watermarkg">
            <svg xmlns="http://www.w3.org/2000/svg" width="100%" height="50px">
              <text x="50%" y="50%"
                  style="display:block"
                  alignment-baseline="middle"
                  text-anchor="middle"
                  font-weight="600"
                  font-color="#323232"
                  font-size="20"
                  font-family="microsoft yahe"
                  >
                  {{tempForm.day}}日
              </text>
            </svg>
          </div>
          <!-- 二维码 -->
          <div class="watermarkh">
            <img style="width:80px;height:80px" :src="tempForm.qrCode" alt="" srcset="">
          </div>
        </div>
        
        <span slot="footer" class="dialog-footer">
          <el-button size="mini" @click="tempVis = false">取 消</el-button>
          <el-button size="mini" type="primary" @click="tempSure">确 定</el-button>
        </span>
      </el-dialog>
      <el-dialog
        title="批量模板生成"
        :visible.sync="tempListVis"
        width="80%">
          <div>
            <div v-for="(item,index) in mulTemplate" :key="index" :id="'temp'+ index" style="height:800px;background:url(https://9001rzsxy.oss-cn-beijing.aliyuncs.com/9001sxy/other/goods/34190d16-a955-406a-8c4f-a0f7c8335b78.jpg
              ) no-repeat center;background-size:100% 100%;">
              <div class="pName3">
                <img style="width:181px;height:190px" :src="item.headPortrait" alt="" srcset="">
              </div>
              <div class="pName1">{{item.orderSn}}</div>
              <div class="pName">{{item.realName}}</div>
              <div class="pName2">{{item.identityCard}}</div>
              <div style="min-height: 69px;">
                <div v-for="(item,index) in item.certificate" :key="index" class="pName4">{{item}}</div>
              </div>
              <div class="pName5">{{item.year}}</div>
              <div class="pName6">{{item.month}}</div>
              <div class="pName7">{{item.day}}</div>
              <div class="pName8">
                <img style="width:80px;height:80px" :src="item.qrCode" alt="" srcset="">
              </div>
            </div>
          </div>
          <span slot="footer" class="dialog-footer">
            <el-button size="mini" @click="tempListVis = false">取 消</el-button>
            <el-button size="mini" type="primary" @click="tempLisSure">确 定</el-button>
          </span>
      </el-dialog>
  </div>
</template>

<script>
import {
  queryorder_school,
  updateorder_school,
  delorder_school,
  upload,
  ex,
  shorder,nijisiai,nijisiai1
} from "@/api/order/orderschool";
import DomToImage from "dom-to-image";

import { certificate__List } from "@/api/certificate/certificateAds";
import { getToken } from "@/utils/auth";
export default {
  components: {},
  props: [],
  data() {
    return {
    tempForm:{
        text: "",
        fontSize: 18,
        width: 6,
        color: "#000000",
        alpha: 35,
        rotate: 35,
        qrCode:''
    },
    headers: { Authorization: "Bearer " + getToken() },
      baseUrl: process.env.VUE_APP_BASE_API,
      moban:'https://9001rzsxy.oss-cn-beijing.aliyuncs.com/9001sxy/other/goods/e3abd0c3-5581-4c4d-8c3d-e2989bbbbb8d.xlsx',
      cateList2: [],
      // 非多个禁用
      multiple: true,
      open: false,
      godaoru:false,
      //删除
      ids: [],
      fileList:[],
      forms:{},
      tempVis:false,
      form: {
          qrCode:'',
          headPortrait: "",
          orderSource:'后台',
          state: '待审核',
          examineStatus:undefined,
      },
      examineList: [
        {
          id: 0,
          title: "取消订单"
        },
        {
          id: 1,
          title: "待付款"
        },
        {
          id: 2,
          title: "已付款待发货"
        },
        {
          id: 3,
          title: "待收货"
        },
        {
          id: 4,
          title: "完成订单"
        }
      ],
      rules:{
           headPortrait: [
            { required: true, message: '请添加头像', trigger: 'blur' },
            // { min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' }
          ],
           realName: [
            { required: true, message: '请输入姓名', trigger: 'blur' },
          ],
           identityCard: [
            { required: true, message: '请输入身份证', trigger: 'blur' },
            // { type: 'number', message: '年龄必须为数字值'},
            { pattern: /^[1-9]{1}[0-9]{14}$|^[1-9]{1}[0-9]{16}([0-9]|[xX])$/,message: '请输入正确的证件号'
          },
          ],
           certificationDate: [
            { required: true, message: '请选择发证日期', trigger: 'blur' },
          ],
           certificateName: [
            { required: true, message: '请选择考试科目', trigger: 'blur' },
          ],
            address: [
            { required: true, message: '请选输入地址', trigger: 'blur' },
          ],
          payMoney: [
            { required: true, message: '请选输入金额', trigger: 'blur' },
          ],
      },
      loading: true,
      //数据
      tableData: [],
      params: {
        pageNum: 1,
        pageSize: 10,
        examineStatus: 6
      },
      pageTotal: 0,
      imgData:{
        certificatePic:'',
        id:'',
        examineStatus:'',
        state:'',
      },
      options:[],
      mulTemplate:[],
      tempListVis:false,
      certOptions: []
    };
  },
  computed: {

  },
  created() {
    this.getData00();
    this.getCertList();
    this.getDicts('kskm').then(res=>{
        console.log(res,'考试科目')
        this.options = res.data
    })
  },
  mounted() {},
  watch: {},
  methods: {
    // 下载模板{}
    xiazia(){
      window.open('https://9001rzsxy.oss-cn-beijing.aliyuncs.com/9001sxy/other/goods/e7f87ccf-aecb-429c-8d3a-f3a1f20bb7f7.xlsx')
    },
    handleTemplate(){
      this.tempListVis = true
    },
    tempLisSure() {
      let that = this;
      for(let a = 0;a<this.mulTemplate.length;a++) {
        // let node = this.$refs[`temp${i}`];
        let node = document.getElementById('temp'+ a);;
        DomToImage.toPng(node)
          .then(function(dataUrl) {
            let i = JSON.parse(JSON.stringify(dataUrl))
            let arr = i.split(",");
            let mime = arr[0].match(/:(.*?);/)[1];
            let suffix = mime.split("/")[1];
            let bstr = atob(arr[1]);
            let n = bstr.length;
            let u8arr = new Uint8Array(n);
            while (n--) {
              u8arr[n] = bstr.charCodeAt(n);
            }
            var fimg = new File([u8arr], `file.${suffix}`, {
              type: mime
            });
            var formData = new FormData();
            formData.append("file", fimg);
            upload(formData).then(res => {
              if(res.code == 200){
                that.imgData.certificatePic =  res.data;
                that.imgData.id = that.mulTemplate[a].id;
                ex(that.imgData).then(res => {
                  if(res.code == 200){
                    that.tempListVis = false;
                  }
                })
              }
            })
            that.$nextTick(() => {
              that.$message.success("证书模板生成成功");
            });
          })
          .catch(function(error) {
            console.log(error)
            that.$message.error("下载失败");
          });
      }
    },
    addTemp(row) {
      this.tempForm = JSON.parse(JSON.stringify(row)) 
      console.log(this.tempForm);
      this.imgData = {
        id:row.id,
        certificatePic:''
      }
      this.tempForm.certificate = this.tempForm.certificateName.split(",")
      this.tempForm.year = this.tempForm.certificationDate.substring(0,4)
      this.tempForm.month = this.tempForm.certificationDate.substring(5,7)
      this.tempForm.day = this.tempForm.certificationDate.substring(8,10)
      this.tempVis = true;
    },
    tempSure() {
      let node = this.$refs.previewImg;
      let that = this;
      DomToImage.toPng(node)
        .then(function(dataUrl) {
          let i = JSON.parse(JSON.stringify(dataUrl))
          let arr = i.split(",");
          let mime = arr[0].match(/:(.*?);/)[1];
          let suffix = mime.split("/")[1];
          let bstr = atob(arr[1]);
          let n = bstr.length;
          let u8arr = new Uint8Array(n);
          while (n--) {
            u8arr[n] = bstr.charCodeAt(n);
          }
          var fimg = new File([u8arr], `file.${suffix}`, {
            type: mime
          });
          var formData = new FormData();
          formData.append("file", fimg);
          upload(formData).then(res => {
            if(res.code == 200){
              that.imgData.certificatePic =  res.data;
              that.imgData.examineStatus = 1
              that.imgData.state = 1
              ex(that.imgData).then(res => {
                if(res.code == 200){
                  that.tempVis = false;
                  that.getData00()
                }
              })
            }
          })
          that.$nextTick(() => {
            that.$message.success("证书模板生成成功");
          });
        })
        .catch(function(error) {
          that.$message.error("下载失败");
        });
    },
    // 导入模板
    daoru(){
      console.log(111)
      this.godaoru = true
    },
    okdaoru(){

    },
    handleChange(file, fileList) {
        this.fileList = fileList.slice(-3);
      },
    handleSuccessq(res){
      console.log(res)
      if(res.code ==200){
          this.fileList.push(res.data)
          this.fileList = this.fileList + ',' + res.data
          console.log( this.fileList)
          this.$message.success("上传成功");
          this.godaoru = false;
          this.getData00()
        }
    },
    xinzeng() {
      console.log(111);
      this.form = {
            qrCode:'',
            address: "",
            certificateName: "",
            certificationDate: "",
            headPortrait: "",
            identityCard: "",
            orderSource: '后台',
            payMoney: "",
            realName: "",
            remarks: "",
            state: '待审核',
      }
      this.open = true;
    },
    openqx(){
        this.open = false
        this.getData00()
    },
    okopen(){
            this.form.certificateName = this.form.certificateName.toString()
            this.form.state = '待审核'?this.form.state = 5:''
            this.form.orderSource = '后台'?this.form.orderSource = 1:''
            this.$refs["form"].validate(valid => {
              if (valid) {
                if (this.form.id != undefined) {
                  nijisiai1(this.form).then(res=>{
                      if(res.code == 200){
                          this.$message.success('编辑成功')
                          this.open = false
                          this.getData00()
                      }
                  })
                } else {
                  this.form.examineStatus = 6
                  console.log(this.form);
                  nijisiai(this.form).then(res=>{
                      // console.log(res,'。。。。。。。。。')
                      if(res.code == 200){
                          this.$message.success('添加成功')
                          this.open = false
                          this.getData00()
                          
                      }
                  })
                }
              }
            });
        // this.form.certificateName = this.form.certificateName.toString()
        // this.form.state = '待审核'?this.form.state = 5:''
        // this.form.orderSource = '后台'?this.form.orderSource = 1:''
        // nijisiai(this.form).then(res=>{
        //     // console.log(res,'。。。。。。。。。')
        //     if(res.code == 200){
        //         this.$message.success('添加成功')
        //         this.open = false
        //         this.getData00()
                
        //     }
        // })
    },
    //获取证书列表
    getData00() {
      queryorder_school(this.params).then(res => {
        console.log(res, "待审核证书");
        if (res.code == 200) {
          this.tableData = res.rows;
          this.pageTotal = res.total;
          this.loading = false;
        }
      });
    },
    resetParams() {
      this.params = {
        pageNum: 1,
        pageSize: 10,
        examineStatus: 6
      };
      this.search();
    },
    getCertList() {
      certificate__List({
        pageNum: 1,
        pageSize: 10000
      }).then(res => {
        this.certOptions = res.rows;
        console.log(this.certOptions);
      });
    },

    // 键值配对
    status(val) {
      var str = this.examineList.find(function(item) {
        return item.id == val;
      });
      if (str) return str.title;
    },

    // 删除操作
    handleSelectionChange(val) {
      this.mulTemplate = val.map(item => {
        return{
          id:item.id,
          realName:item.realName,
          orderSn:item.orderSn,
          identityCard:item.identityCard,
          certificate:item.certificateName.split(","),
          year:item.certificationDate.substring(0,4),
          month:item.certificationDate.substring(5,7),
          day:item.certificationDate.substring(8,10),
          headPortrait:item.headPortrait,
          qrCode:item.qrCode
        }
      })
      this.ids = val.map(item => item.id);
      this.single = val.length != 1;
      this.multiple = !val.length;
      console.log(this.multiple)
    },
    bianji(row){
        console.log(row)
         this.open = true;
         this.form = {
            qrCode:row.qrCode,
            address:row.address,
            certificateName:row.certificateName.split(','),
            certificationDate:row.certificationDate,
            headPortrait:row.headPortrait,
            identityCard:row.identityCard,
            orderSource:row.orderSource = 1?row.orderSource = '后台':'',
            payMoney:row.payMoney,
            realName:row.realName,
            remarks:row.remarks,
            state:row.state = 5?row.state = '待审核':'',
            id:row.id
         }
        //  this.certificateName = row.certificateName.split(','),
         console.log(this.certificateName =row.certificateName.split(','),)
    },
    // 审核
    handleDelete(row) {
      const id = row.id || this.ids;
      this.$confirm("是否进行审核?", "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(function() {
          return shorder(id);
        })
        .then(() => {
          this.getData00();
          this.msgSuccess("成功");
        })
        .catch(function() {});
    },
    // 删除
      shanchu(row) {
      const id = row.id || this.ids;
       this.$confirm("是否确认删除?", "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(function() {
          return delorder_school(id);
        })
        .then(() => {
          this.getData00();
          this.msgSuccess("删除成功");
        })
        .catch(function() {});
    },
    uploadPicUrl(res){
        console.log(res.data)
        this.form.headPortrait ='https://9001rzsxy.oss-cn-beijing.aliyuncs.com' + res.data
    },
    uploadPicUrl1(res) {
        console.log(res.data)
      this.form.qrCode ='https://9001rzsxy.oss-cn-beijing.aliyuncs.com'+ res.data
        console.log(this.form)
    },
    // 触发搜索按钮
    search() {
      this.$set(this.params, "pageNum", 1);
      this.paramsFlag = 0;
      this.getData00();
    },
    // 分页导航
    handlePageChange(val) {
      this.$set(this.params, "pageNum", val);
      this.getData00();
    }
  }
};
</script>
<style>
.avatar-uploader .el-upload {
    border: 1px dashed #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
  }
  .avatar-uploader .el-upload:hover {
    border-color: #409EFF;
  }
  .avatar-uploader-icon {
    font-size: 28px;
    color: #8c939d;
    width: 120px;
    height: 120px;
    line-height: 120px;
    text-align: center;
  }
  .avatar {
    width: 120px;
    height: 120px;
    display: block;
  }
</style>
<style scoped>
.resource {
  padding: 20px 30px;
}
.handle-box {
  margin-bottom: 10px;
}

.table {
  width: 100%;
  font-size: 14px;
}
.red {
  color: #ff0000;
}
.yellow {
  color: #f57506;
}
.green {
  color: green;
  cursor: pointer;
}
.blue2 {
  color: #409eff;
}
.blue {
  color: #409eff;
  cursor: pointer;
  text-decoration: underline;
}
.mr10 {
  margin-right: 10px;
}
.ml20 {
  margin-left: 20px;
}
.mt20 {
  margin-bottom: 10px;
}

.searchForm .el-form-item--mini.el-form-item,
.searchForm .el-form-item--small.el-form-item {
  margin-bottom: 1px;
}
.study_pic {
  display: block;
  width: 60px;
  height: 60px;
  margin: auto;
  border-radius: 50%;
}

</style>
<style lang="scss" scoped>
  .preview {
    position: relative;
    margin-left: 20px;
    max-width: 360px;
    img {
      width: 100%;
      height: 100%;
    }
    .watermarkf{
      position: absolute;
      left: 530px;
      top: 335px;
      width: 100%;
      height: 100%;
    }
    .watermarkg{
      position: absolute;
      left: 593px;
      top: 335px;
      width: 100%;
      height: 100%;
    }
    .watermarke{
      position: absolute;
      left: 461px;
      top: 335px;
      width: 100%;
      height: 100%;
    }
    .watermarkd{
      position: absolute;
      left: 523px;
      top: 143px;
      width: 100%;
      height: 100%;
    }
    .watermarka{
      position: absolute;
      left: 105px;
      top: 552px;
      width: 100%;
      height: 100%;
    }
    .watermarkc{
      position: absolute;
      left: 85px;
      top: 262px;
      width: 100%;
      height: 100%;
    }
    .watermarkb{
      position: absolute;
      left: 73px;
      top: 439px;
      width: 100%;
      height: 100%;
    }
    .watermark {
      position: absolute;
      left: 22px;
      top: 495px;
      width: 100%;
      height: 100%;
    }
    .watermarkh {
      position: absolute;
      left: 704px;
      top: 320px;
      width: 100%;
      height: 100%;
    }
  }
  .pName{
    width: 150px;
    position: relative;
    top:385px;
    left: 277px;
    font-size: 20px;
    font-weight: 600;
  }
  .pName1{
    width: 150px;
    position: relative;
    top:341px;
    left: 277px;
    font-size: 20px;
    font-weight: 600;
  }
  .pName2{
    width: 300px;
    position: relative;
    top:430px;
    left: 277px;
    font-size: 20px;
    font-weight: 600;
  }
  .pName3{
    width: 190px;
    position: relative;
    top:310px;
    left: 303px;
    font-size: 20px;
    font-weight: 600;
  }
  .pName4{
    width: 500px;
    position: relative;
    top:-82px;
    left: 811px;
    font-size: 20px;
    font-weight: 600;
  }
  .pName5{
    width: 150px;
    position: relative;
    top:80px;
    left: 937px;
    font-size: 20px;
    font-weight: 600;
  }
  .pName6{
    width: 150px;
    position: relative;
    top:59px;
    left: 1035px;
    font-size: 20px;
    font-weight: 600;
  }
  .pName7{
    width: 150px;
    position: relative;
    top:38px;
    left: 1130px;
    font-size: 20px;
    font-weight: 600;
  }
  .pName8{
    width: 150px;
    position: relative;
    top:14px;
    left: 1238px;
    font-size: 20px;
    font-weight: 600;
  }
</style>